package net.jeeshop.services.front.bbs.dao.impl;

import net.jeeshop.core.dao.BaseDao;
import net.jeeshop.core.dao.page.PagerModel;
import net.jeeshop.services.front.bbs.bean.BbsDetail;
import net.jeeshop.services.front.bbs.bean.BbsImg;
import net.jeeshop.services.front.bbs.dao.BbsDetailDao;
import net.jeeshop.services.front.bbs.dto.BbsDetailDTO;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Created by zuohao on 16/7/7.
 */
@Repository("bbsDetailDaoFront")
public class BbsDetailDaoImpl implements BbsDetailDao {

    @Resource
    private BaseDao dao;

    @Override
    public int insert(BbsDetail bbsDetail) {
        return dao.insert("front.bbsDetail.insert",bbsDetail);
    }

    @Override
    public int delete(BbsDetail bbsDetail) {
        return 0;
    }

    @Override
    public int update(BbsDetail bbsDetail) {
        return 0;
    }

    @Override
    public BbsDetail selectOne(BbsDetail bbsDetail) {
        return null;
    }

    @Override
    public PagerModel selectPageList(BbsDetail bbsDetail) {
        return null;
    }

    @Override
    public List<BbsDetail> selectList(BbsDetail bbsDetail) {
        return null;
    }

    @Override
    public int deleteById(int id) {
        return 0;
    }

    @Override
    public BbsDetail selectById(String id) {
        return null;
    }

    @Override
    public List selectBbsDetailList(Map<String,Object> map) {
        return dao.selectList("front.bbsDetail.selectBbsDetailList",map);
    }

    @Override
    public int selectBbsDetailCountList(Map<String,Object> map) {
        return dao.getCount("front.bbsDetail.selectBbsDetailCountList",map);
    }

    @Override
    public void insertBbsDetail(BbsDetail bbsDetail) {
        dao.insert("front.bbsDetail.insertBbsDetail",bbsDetail);
    }

    @Override
    public int deleteBbsDetailById(Map map) {
//        return dao.delete("front.bbsDetail.deleteBbsDetailById",detailId);
        return dao.update("front.bbsDetail.updateStatusById", map);
    }

    @Override
    public void insertBbsImage(BbsImg bbsImg) {
        dao.insert("front.bbsDetail.insertBbsImage",bbsImg);

    }

    @Override
    public List<BbsImg> selectBbsImage(String detailId) {
        return dao.selectList("front.bbsDetail.selectBbsImage",detailId);
    }

    @Override
    public BbsDetailDTO selectBbsDetail(BbsDetail bbsDetail) {
        return (BbsDetailDTO) dao.selectOne("front.bbsDetail.selectBbsDetail",bbsDetail);
    }
}
